﻿@using SDCloudSolution.SDCloud.Web.Utils
@model SDCloudSolution.SDCloud.Web.Models.ModelRun.ModelRunListViewModel

@if (Model.Items.Count > 0)
{
    <table>
        <thead class="oj-table-header">
            <tr class="oj-table-header-row">
                <th class="oj-table-column-header-cell">
                    <div class="oj-table-column-header">
                        <div class="oj-table-column-header-text">
                            #
                        </div>
                    </div>
                </th>
                <th class="oj-table-column-header-cell">
                    <div class="oj-table-column-header">
                        <div class="oj-table-column-header-text">
                            Model
                        </div>
                    </div>
                </th>
                <th class="oj-table-column-header-cell">
                    <div class="oj-table-column-header">
                        <div class="oj-table-column-header-text">
                            Time
                        </div>
                    </div>
                </th>
            </tr>
        </thead>
        @foreach (var item in Model.Items)
        {
            <tbody class="oj-table-body">
                <tr class="oj-table-body-row oj-table-hgrid-lines">
                    <td class="oj-table-data-cell oj-form-control-inherit">
                        <span class="label label-@item.StatusType.ToCssClass()" title="@item.StatusTitle">
                            @item.ModelRunId
                        </span>
                    </td>
                    <td class="oj-table-data-cell oj-form-control-inherit">
                        @Html.ActionLink(item.ModelName, MVC.ModelRuns.View(item.ModelRunId))
                    </td>
                    <td>@item.ElapsedTime</td>
                </tr>
            </tbody>
        }
    </table>
}
else
{
    <p>
        No active model runs for now :)
    </p>
}

<div class="oj-table-footer-row">
    <div class="text-center">
        @Html.ActionLink("Show all", MVC.ModelRuns.List(), new
   {
       @class = "oj-link"
   })
    </div>
</div>
